<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>考勤记录</title>
	<link rel="stylesheet" href="../css/common2.css">
	<link rel="stylesheet" href="../css/motai3.css">
	<style>
		canvas {
			position: fixed;
			top: 0;
			left: 0;
			z-index: -1;
		}

		.search_img {
			position: absolute;
			margin-top: -30px;
			right: 3%;
		}

		.long-background-img {
			width: 120px;
			height: 35px;
			margin-left: 10px;
			background: url("../image/enter_longer.png") no-repeat center center !important;
		}

		.other {
			margin-top: -30px;
			max-width: 120px;
			width: 15vw;

			padding-left: 20px;
			font-size: 14px;
			color: #686868;
			position: absolute;
			border: 1px solid;
			display: inline-block;
		}

		.export {
			margin-left: 10px;
		}

		.layui-input {
			display: block;
			width: 250px;
			padding-left: 10px;

			border-width: 1px;
			border-style: solid;
			border-radius: 2px;
			color: black;
			background-color: #ffffff;
			border: 1px silver solid;
		}

		input,
		select {
			height: 35px !important;
			box-sizing: border-box;
		}
	</style>
</head>

<body>
	<div id="vue-root">
		<div class="href_head" style="margin-top: 60px;">
			<div class="refresh action-buttons" onclick="location.reload()">刷新</div>

			<input class="other" placeholder="请输入姓名" v-model="search.name" @keyup.enter="getData0"
				style="position: absolute; right: 707px; margin-top: 2px;" />


			<select class="classes search" v-model="search.level"
				style="position: absolute; right: 551px; margin-top: 5px;">
				<option :value="undefined">请选择活动等级</option>
				<option value="一级">一级</option>
				<option value="二级">二级</option>
				<option value="三级">三级</option>
				<option value="四级">四级</option>
				<option value="五级">五级</option>
			</select>

			<div class="chooses">
				<select class="classes search" v-model="search.classesId"
					style="position: absolute; right: 260px; margin-top: -30px;">
					<option :value="undefined">请选择班级</option>
					<option v-for="classes in classess" :key="classes.id" :value="classes.id" v-text="classes.name">
					</option>
				</select>
			</div>

		</div>
		<input placeholder="开始时间" class="other" v-model="search.startTime" id="startTime"
			style="width: 65px;font-size:12px;position: absolute; right: 170px;padding-left: 5px;">
		<input placeholder="结束时间" class="other" v-model="search.endTime" id="endTime"
			style="width: 65px;font-size:12px;position: absolute; right: 100px; margin-top: -30px;padding-left: 5px;border-left: none;">


		<select class="ui-select search" v-model="search.deviceId"
			style="position: absolute; right: 416px;top: 65px; max-width: 120px;">
			<option :value="undefined">请选择活动室</option>
			<option v-for="device in devices" :key="device.id" :value="device.id" v-text="device.name">
			</option>
		</select>

		<img src="../image/search.png" height="35" width="35" class="search_img" @click="getData0">
		<div class="table">
			<table class="table_top">
				<thead>
					<tr>
						<th class="one">
							<input type="checkbox" class="check-box" v-model="all">序号
						</th>
						<th>活动室</th>
						<th>幼儿姓名</th>
						<th>班级</th>
						<th>进入时间</th>
						<th>离开时间</th>
						<th>游戏活动时间</th>
						<th>活动等级</th>
					</tr>
				</thead>
				<tbody id="list">
					<tr v-for="(item,index) in list" :key="index">
						<td class="one">
							<span v-text="index+1"></span>
						</td>
						<td v-text="item.deviceName"></td>
						<td v-text="item.studentName"></td>
						<td v-text="item.classesName"></td>
						<td v-text="item.enterTime"></td>
						<td v-text="item.leaveTime"></td>
						<td v-text="item.minute"></td>
						<td v-text="item.level"></td>
					</tr>
				</tbody>
			</table>
		</div>
		<br>

		<div class="delete export" @click="exports">批量导出</div>


	</div>

	<script src="/scriptZIP/qs.min.js"></script>
	<script src="/scriptZIP/vue.min.js"></script>
	<script src="/scriptZIP/axios.min.js"></script>

	<script src="/lib/laydate/laydate.js"></script>

	<script src="/js/common.js"></script>
	<script src="/js/list.js"></script>
	<script src="/js/bg.js"></script>

	<script>
		var app = new Vue(merge({
			data: {
				classess: [],
				devices: [],
				search: {
					only: false
				},
				urls: {
					del: '/pc/item/del'
				},
				show: false,
				date: null
			},
			created: function () {
				var schoolId = localStorage['schoolId'];
				if (!schoolId) {
					alert('请先登录学校后台再打开此页面');
					return;
				}
				this.schoolId = schoolId;

				this.urls.list = '/pc/attendance/duration/' + schoolId;
				this.getData();
				axios.get('/pc/classes/all/' + schoolId).then(function (res) {
					this.classess = res.data;
				}.bind(this));
				axios.get('/pc/device/all/' + schoolId).then(function (res) {
					this.devices = res.data;
				}.bind(this));
			},
			methods: {
				setData: function (res) {
					this.list = res.data;
					if (this.search.level)
						this.list = this.list.filter(function (it) {
							return it.level == this.search.level;
						}.bind(this));
				},
				exports: function () {
					var q = Qs.stringify(this.search);
					if (q) q = '?' + q;
					location.href = '/pc/attendance/duration/export/' + this.schoolId + q;
				}
			}
		}));

		laydate.render({
			elem: '#startTime',
			type: 'datetime',
			done: function (value, date, endDate) {
				app.search.startTime = value;
			}
		});

		laydate.render({
			elem: '#endTime',
			type: 'datetime',
			done: function (value, date, endDate) {
				app.search.endTime = value;
			}
		});
	</script>

</body>

</html>